package com.efuture.jdbctemplate;

import com.efuture.druid.DruidUtils;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * @ClassNAME JdbcTemplateQueryForObject
 * @Description JdbcTemplate QueryForObject方法的使用
 * @Author zhaoshanshan
 * @Date 2021/9/20 10:15 下午
 * @Version 1.0
 */
public class JdbcTemplateQueryForObject {

    public static void main(String[] args) {
        try{
            JdbcTemplate jdbcTemplate = new JdbcTemplate(DruidUtils.getDataSource());
            String sql = "select count(id) from emp";
            Long count = jdbcTemplate.queryForObject(sql,Long.class);
            System.out.println(count);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}